﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Three
{
    public enum GAME_STATE
    { 
        BEGIN,
        ONGOING,
        END
    }

    internal class Game
    {
        public const int w=80;
        public const int h=20;

        static ISceneUpdate curScene;

        static ISceneUpdate[] scenes;

        public Game()
        {
            Console.CursorVisible = false;
            Console.SetWindowSize(w, h);
            Console.SetBufferSize(w, h);
            scenes = new ISceneUpdate[] { new BeginScene(), new GameScene(), new EndScene() };
            ChangeScene(GAME_STATE.BEGIN);
        }

        public void Start()
        {
            while (true)
            {
                if (curScene != null)
                {
                    curScene.Update();
                }
            }
        }

        public static void ChangeScene(GAME_STATE nextState)
        {
            Console.Clear();
            switch (nextState)
            { 
                case GAME_STATE.BEGIN:
                    curScene=scenes[0];
                    break;
                case GAME_STATE.ONGOING:
                    curScene = scenes[1];
                    break;
                case GAME_STATE.END:
                    curScene = scenes[2];
                    break; 
                default:break;
            }
        }

    }
}
